import getconnection.getconnectionclass;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;


public class testdata {

	/**
	 * @param args
	 * @throws SQLException 
	 * @throws ClassNotFoundException 
	 */
	public static void main(String[] args) throws SQLException, ClassNotFoundException {
		Connection c=getconnectionclass.getconnection();
        Statement statement=c.createStatement();
    
		String s="delete from userinfo where username='pp'";
	    //PreparedStatement ps=c.prepareStatement(s);
	    //ps.setString(1, "jinhua");
	    //ps.execute();
		int i=statement.executeUpdate(s);
        System.out.println(i);
        ResultSet rs=statement.executeQuery("select * from userinfo");
        ArrayList<User> al=new ArrayList<User>();
        
        while(rs.next()){
//        	System.out.print(rs.getString("username"));
//        	System.out.println(rs.getString("passwd"));
        	User u=new User();
        	u.setUserName(rs.getString("username"));
        	u.setPassWord(rs.getString("passwd"));
           al.add(u);
            
        }
        for(User s2:al)
        System.out.println(s2);
        statement.close();
        c.close();
	}

}
